﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2006" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
	x:Class="SmartCA.Presentation.Views.ProposalRequestView"
	xmlns:presentation="clr-namespace:SmartCA.Presentation.Views"
	Title="Proposal Requests"
	x:Name="proposalRequestsWindow"
	Width="800" Height="600" Background="{StaticResource FormBackgroundBrush}">
    
    <Grid>
    
		<Grid.RowDefinitions>
		  <RowDefinition Height="Auto" />
		  <RowDefinition />
		  <RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
		  <ColumnDefinition Width="1*" />
		  <ColumnDefinition Width="2*" />
		</Grid.ColumnDefinitions>
		
		<Label Style="{StaticResource headerLabelStyle}" Margin="10" Grid.Row="0" Grid.Column="0">Proposal Requests</Label>
		<Label Style="{StaticResource headerLabelStyle}" Margin="0,10,10,10" Grid.Row="0" Grid.Column="1">Selected Proposal Request</Label>
		
		<ListBox Margin="10,0,10,10" Grid.Row="1" Grid.Column="0" 
			IsSynchronizedWithCurrentItem="True" 
			SelectedItem="{Binding Path=CurrentEntity}"
			ItemsSource="{Binding Path=EntitiesView}"
			DisplayMemberPath="Number"/>
			
		<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,10" Grid.Row="1" Grid.Column="1">
			<ScrollViewer>
				<Grid>
				
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="200" />
						<ColumnDefinition Width="Auto" />
					</Grid.ColumnDefinitions>
					
					<Label Grid.Row="0" Grid.Column="0" Content="Proposal Request Number:" 
						Style="{StaticResource baseLabelStyle}"/>
					<TextBox Grid.Row="0" Grid.Column="1" 
						Text="{Binding Path=CurrentEntity.Number}"/>
						
					<Label Grid.Row="1" Grid.Column="0" Content="From:"
						Style="{StaticResource baseLabelStyle}"/>
					<ComboBox Grid.Row="1" Grid.Column="1"
						SelectedItem="{Binding Path=CurrentEntity.From}"
						IsSynchronizedWithCurrentItem="True"
						ItemsSource="{Binding Path=FromList}">	
						<ComboBox.ItemTemplate>
							<DataTemplate>
								<Grid>
									<Grid.ColumnDefinitions>
										<ColumnDefinition />
										<ColumnDefinition />
										<ColumnDefinition />
									</Grid.ColumnDefinitions>
									<TextBlock Grid.Column="0" Text="{Binding Path=FirstName}"/>
									<TextBlock Grid.Column="1" Text=" " />
									<TextBlock Grid.Column="2" Text="{Binding Path=LastName}"/>
								</Grid>
							</DataTemplate>
						</ComboBox.ItemTemplate>				
					</ComboBox>
					
					<Label Grid.Row="2" Grid.Column="0" Content="To:"
						Style="{StaticResource baseLabelStyle}"/>
					<ComboBox Grid.Row="2" Grid.Column="1"
						SelectedItem="{Binding Path=CurrentEntity.To}"
						IsSynchronizedWithCurrentItem="True"
						ItemsSource="{Binding Path=ToList}">
						<ComboBox.ItemTemplate>
							<DataTemplate>
								<Grid>
									<Grid.ColumnDefinitions>
										<ColumnDefinition />
										<ColumnDefinition />
										<ColumnDefinition />
									</Grid.ColumnDefinitions>
									<TextBlock Grid.Column="0" Text="{Binding Path=Contact.FirstName}"/>
									<TextBlock Grid.Column="1" Text=" " />
									<TextBlock Grid.Column="2" Text="{Binding Path=Contact.LastName}"/>
								</Grid>
							</DataTemplate>
						</ComboBox.ItemTemplate>					
					</ComboBox>
					
					<presentation:Transmittal Grid.Row="3" Grid.Column="0" 
						Grid.ColumnSpan="2" DataContext="{Binding Path= .}"/>
						
					<Label Grid.Row="4" Grid.Column="0" Content="Issue Date:"
						Style="{StaticResource baseLabelStyle}"/>
					<DatePicker Grid.Row="4" Grid.Column="1" 
						SelectedDate="{Binding Path=CurrentEntity.IssueDate}" />
					
					<Label Grid.Row="5" Grid.Column="0" Content="Expected Contractor Return Date:"
						Style="{StaticResource baseLabelStyle}"/>
					<DatePicker Grid.Row="5" Grid.Column="1" 
						SelectedDate="{Binding Mode=OneWay, Path=CurrentEntity.ExpectedContractorReturnDate}" />
						
					<Label Grid.Row="6" Grid.Column="0" Content="Contractor:" 
						Style="{StaticResource baseLabelStyle}"/>
					<TextBox Grid.Row="6" Grid.Column="1" 
						Text="{Binding Path=CurrentEntity.Contractor}"/>
						
					<Label Grid.Row="7" Grid.Column="0" Content="Description:" 
						Style="{StaticResource baseLabelStyle}"/>
					<TextBox Grid.Row="7" Grid.Column="1" 
						Text="{Binding Path=CurrentEntity.Description}"/>
						
					<Label Grid.Row="8" Grid.Column="0" Content="Attachment:" 
						Style="{StaticResource baseLabelStyle}"/>
					<TextBox Grid.Row="8" Grid.Column="1" 
						Text="{Binding Path=CurrentEntity.Attachment}"/>
						
					<Label Grid.Row="9" Grid.Column="0" Content="Reason:" 
						Style="{StaticResource baseLabelStyle}"/>
					<TextBox Grid.Row="9" Grid.Column="1" 
						Text="{Binding Path=CurrentEntity.Reason}"/>
						
					<Label Grid.Row="10" Grid.Column="0" Content="Initiator:" 
						Style="{StaticResource baseLabelStyle}"/>
					<TextBox Grid.Row="10" Grid.Column="1" 
						Text="{Binding Path=CurrentEntity.Initiator}"/>
						
					<Label Grid.Row="11" Grid.Column="0" Content="Cause/Origin:" 
						Style="{StaticResource baseLabelStyle}"/>
					<StackPanel Orientation="Horizontal" Grid.Row="11" Grid.Column="1">
						<TextBox 
							Text="{Binding Path=CurrentEntity.Cause}"/>
						<Label Content="." Style="{StaticResource baseLabelStyle}"/>
						<TextBox 
							Text="{Binding Path=CurrentEntity.Origin}"/>
					</StackPanel>
					
					<Label Grid.Row="12" Grid.Column="0" Content="Transmittal Remarks:" 
						Style="{StaticResource baseLabelStyle}"/>
					<TextBox Grid.Row="12" Grid.Column="1" 
						Text="{Binding Path=CurrentEntity.Remarks}"/>
							
			</Grid>
		  </ScrollViewer>
		</Border>
		
		<Button HorizontalAlignment="Right" Margin="10,0,10,10" Grid.Row="2" Grid.Column="0" Command="{Binding Path=NewCommand}">New</Button>
		<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Row="2" Grid.Column="1">
		  <Button Grid.Row="2" Margin="10,0,10,10" Grid.Column="0" Command="{Binding Path=SaveCommand}">Save</Button>
		  <Button Grid.Row="2" Margin="0,0,10,10" Grid.Column="0" Command="{Binding Path=CancelCommand}">Cancel</Button>
		</StackPanel>
        
    </Grid>
    
</Window>
